<?php
if (!isset($_COOKIE["login"])){
  header("Location: login.html");
  }
else { ?>
<html>
  <head>
    <title>Studio L&amp;C - Admin</title>
  </head>
  <body>
    <center>
    <b>RICHIESTE DA SITO</b>
    <fieldset>
      <legend>
        Elenco richieste di informazioni da sito
      </legend>
      <table border=1>
      <tr align="center">
        <td>ID Richiesta</td>
        <td>IP</td>
        <td>Data</td>
        <td>&nbsp;</td>
      </tr>
<?php
require_once("connect.php");
$sql_req_adm = $PDO->query("SELECT * FROM request_t");
$sql_req_adm->setFetchMode(PDO::FETCH_ASSOC);
while($row_ra = $sql_req_adm->fetch()){
  $dataconv = date ("d/m/Y H:i:s", $row_ra[data]);
  print("<tr align=\"center\"><td>" . $row_ra[id_req] . "</td><td>" . $row_ra[ip] . "</td><td>" . $dataconv . "</td><td><form id=\"delReq\" method=\"post\" action=\"delreq.php\"><input value=\"" . $row_ra[id_req] . "\" type=\"hidden\" name=\"id_req\"><input type=\"submit\" value=\"ELIMINA\"></form></td></tr>");
}
?>
      </table>
  	</fieldset>
    <br>
  </center>
  </body>
</html>
<?php
  }
?>